<?php
require_once('FixtureFactory.php');

class Gradua_PHPUnit_Extensions_SeleniumTestCase extends PHPUnit_Extensions_SeleniumTestCase {
    static $fixtureFactory = null;
    protected $ff;
    /* public static $browsers = array(
     array(
     'name'    => 'Firefox',
     'browser' => 'firefox'
     ),
     array(
     'name'    => 'Internet Explorer',
     'browser' => 'iexplore'
     )
     );*/
    /*
     * @return FixtureFactory
     */
    function getFixtureFactory()
    {
        if(!self::$fixtureFactory) {
            self::$fixtureFactory = new FixtureFactory();
        }
        return self::$fixtureFactory;
    }



    function setUp()
    {
        require_once('symfony.env.config.php');
        $configuration = ProjectConfiguration::getApplicationConfiguration( SF_APP_NAME , SF_ENV, true);
        sfContext::createInstance($configuration);
        //sfContext::getInstance()->getUser()->initSession('phpunit');
        $this->clearAttemptsTable();
        ServiceLogger::$log = false;

        $this->setBrowser('firefox');
        $this->setBrowserUrl('http://' . sfConfig::get('app_hostname'));
    }

    public function clearAttemptsTable() {
        $query = 'Delete from login_attempts where 1';
        $conn = Doctrine::getTable('PurchaseOption')->getConnection();
        $conn->setAttribute(PDO::ATTR_AUTOCOMMIT,true);
        $result = $conn->exec($query);
    }
}